package router

import (
	app "bookkeeping-gin/app/controller"
	"bookkeeping-gin/app/middleware"
	"bookkeeping-gin/app/service"
	"github.com/gin-gonic/gin"
)

// SetApiGroupRoutes 定义 api 分组路由
func SetApiGroupRoutes(r *gin.RouterGroup) {
	r.POST("/user/register", app.Register)
	r.POST("/user/login", app.Login)

	// 需要鉴权的路由
	authRouter := r.Group("").Use(middleware.JwtAuth(service.AppGuardName))
	{
		authRouter.GET("/user/me", app.GetMeInfo)
		authRouter.GET("/user/info", app.GetUserInfoById)
		authRouter.POST("/user/logout", app.Logout)
		authRouter.GET("/tag/list", app.GetTagList)
		authRouter.POST("/tag/create", app.CreateTag)
		authRouter.POST("/tag/edit", app.EditTag)
		authRouter.POST("/tag/delete", app.DeleteTag)
	}
}
